﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TathamOddie.OpenSearchValidator.Logic.Tasks.Rss;

namespace TathamOddie.OpenSearchValidator.Logic.Tasks.Description
{
	public class ValidateOpenSearchDescriptionTask : XmlValidationTask
	{
		string descriptionXmlContent;

		public ValidateOpenSearchDescriptionTask(Uri descriptionUri, string descriptionXmlContent)
			: base("OpenSearch description", descriptionUri, descriptionXmlContent, Resources.XmlSchemaResources.OpenSearchDescription)
		{
			this.descriptionXmlContent = descriptionXmlContent;
		}

		protected override void OnValidateSuccess(ValidationTaskResult result)
		{
			result.ChildTasks.Add(new Html.FindHtmlSearchInterfaceTask(descriptionXmlContent));
			result.ChildTasks.Add(new Json.FindJsonSearchInterfaceTask(descriptionXmlContent));
			result.ChildTasks.Add(new Rss.FindRssSearchInterfaceTask(descriptionXmlContent));
			result.ChildTasks.Add(new VisualSearch.FindVisualSearchInterfaceTask(descriptionXmlContent));
		}
	}
}